package br.pucrio.inf.les.SPLAnalyser.impl.visualize;

import br.pucrio.inf.les.SPLAnalyser.core.Visualizer;
import br.pucrio.inf.les.SPLAnalyser.core.models.impactanalysismodel.ImpactAnalysisModel;
import br.pucrio.inf.les.SPLAnalyser.core.models.impactvisualizermodel.ResultSet;
import br.pucrio.inf.les.SPLAnalyser.core.models.util.ImpactVisualizerModelHandler;
import br.pucrio.inf.les.SPLAnalyser.core.models.util.ModelContent;
import br.pucrio.inf.les.SPLAnalyser.impl.query.models.RemoveFeatureQueryModel;

public class RemoveFeatureVisualizer implements Visualizer {

	@Override
	public void runVisualize(Object queryModel, String queryName,
			String projectPath) {

		RemoveFeatureQueryModel removeFeatureQueryModel 
				= (RemoveFeatureQueryModel) queryModel;
		
		ImpactVisualizerModelHandler visualizerModelContent 
				= new ImpactVisualizerModelHandler(queryName);

		ResultSet exclusiveAssetsSet = visualizerModelContent
				.addResultSet("Exclusive Assets");		
		visualizerModelContent.addAssetResult(exclusiveAssetsSet,
				removeFeatureQueryModel.getExclusiveAssets());

		ResultSet dependentAssetsSet = visualizerModelContent
				.addResultSet("Dependent Assets");		
		visualizerModelContent.addAssetResult(dependentAssetsSet,
				removeFeatureQueryModel.getDependentAssets());

		ResultSet sharedAssetsSet = visualizerModelContent
				.addResultSet("Shared Assets");		
		visualizerModelContent.addAssetResult(sharedAssetsSet,
				removeFeatureQueryModel.getSharedAssets());

		ResultSet affectedFeaturesSet = visualizerModelContent
				.addResultSet("Affected Features");		
		visualizerModelContent.addFeatureResult(affectedFeaturesSet,
				removeFeatureQueryModel.getAffectedFeatures());

		String queryModelPath = projectPath + "/ImpactAnalysis/querys/"
		+ queryName + ".impactanalysismodel";

		visualizerModelContent.saveModel(queryModelPath);
	}

}
